diff options
| author | Rafi Zadanly <rafizadanly@gmail.com> | 2022-11-20 01:08:57 +0700 |
|---|---|---|
| committer | Rafi Zadanly <rafizadanly@gmail.com> | 2022-11-20 01:08:57 +0700 |
| commit | 6df02d6a2bf6d5ea77f7703917f2709562308a1a (patch) | |
| tree | 4695dcefecead7d66ebec74b938e0987328ce1cd /src/pages/shop/product/[slug].js | |
| parent | ce16ffadc9c0db5a31665d30aff2b6eeaa8e7834 (diff) | |
Improve page transition and product card badge
Diffstat (limited to 'src/pages/shop/product/[slug].js')
| -rw-r--r-- | src/pages/shop/product/[slug].js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/pages/shop/product/[slug].js b/src/pages/shop/product/[slug].js index 923962e2..352edb99 100644 --- a/src/pages/shop/product/[slug].js +++ b/src/pages/shop/product/[slug].js @@ -46,7 +46,7 @@ export default function ProductDetail({product}) { const dataSimilarProducts = await apiOdoo('GET', `/api/v1/product/${getId(slug)}/similar?limit=20`); setSimilarProducts(dataSimilarProducts); } - getSimilarProducts(); + if (slug) getSimilarProducts(); }, [slug]); useEffect(() => { @@ -81,8 +81,7 @@ export default function ProductDetail({product}) { return ( <> <Header title={`${product.name} - Indoteknik`}/> - <Layout key={`/shop/product/${slug}`}> - + <Layout> <LazyLoadImage effect="blur" src={product.image} alt={product.name} className="border-b border-gray-300 w-full h-[300px] object-contain object-center bg-white" /> <div className="p-4 pb-10"> <Link href={'/shop/brands/' + createSlug(product.manufacture.name, product.manufacture.id)}> @@ -96,7 +95,7 @@ export default function ProductDetail({product}) { {product.lowest_price.discount_percentage > 0 ? ( <div className="flex gap-x-1 items-center"> - <span className="badge-yellow">{activeVariant.price.discount_percentage}%</span> + <span className="badge-red">{activeVariant.price.discount_percentage}%</span> <p className="text-xs text-gray-800 line-through">{currencyFormat(activeVariant.price.price)}</p> </div> ) : ''} @@ -169,7 +168,6 @@ export default function ProductDetail({product}) { <h2 className="h1 mb-4">Produk Lainnya</h2> <ProductSlider products={similarProducts}/> </div> - </div> </Layout> </> |
